#ifndef VIDEOANALYSISSYSTEM_VAS_DO_H
#define VIDEOANALYSISSYSTEM_VAS_DO_H
#include <condition_variable>
#include <opencv2/opencv.hpp>
namespace vas {
    struct Coord {
        int x, y;
    };

    struct Box {
        Coord top_left, bottom_right;
    };

    struct PedestrianData {
        std::string id;
        Box box;
        std::vector <std::string> attributes;
        std::vector <Coord> key_points;
        std::vector <std::string> actions;
        std::vector <Coord> traces;
        bool restricted_area;
    };

    struct Task {
        std::string type;
        int interval;
        std::vector <Coord> roi;
    };

    struct Channel {
        std::string channel;
        std::string url;
        std::vector <Task> tasks;
    };

    struct AlgorithmData {
        // statistic data
        std::string uuid;
        long ctime;
        long mtime;
        // Input Data
        Channel channel;
        long timestamp;
        cv::Mat image;
        // Route Info
        std::vector <std::string> routes;
        std::vector <std::string> traces;
        // Algorithm Result
        std::set <std::string> scenes;
        std::vector <PedestrianData> pedestrians;
    };

    struct VasConfig{
        std::map<std::string, bool> algorithm_mock;
        int http_port;
        int http_threads;
        int max_videos;
        int algorithm_threads;
        std::string rocket_mq_host;
        std::string zookeeper_host;
        std::vector<Channel> local_channels;
    };

    struct AlgorithmPoolData {
        std::mutex mtx;
        std::condition_variable cond;
        std::queue<AlgorithmData*> queue;
        bool shutdown = false;
        size_t queue_max = 25000;
    };

    struct GCacheData {
        std::string name_space;
        std::string group;
        std::string key;
        long ctime;
        long mtime;
        int keep_size;
        void *ptr;
    };
}
#endif //VIDEOANALYSISSYSTEM_VAS_DO_H
